package com.skit.main.ui.type.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.skit.common.bean.ActivityBean
import com.skit.main.databinding.MainItemActivityTypeBinding

/**
 * @author shuike <a href="mailto:shuike007@126.com">Contact me.</a>
 * @version 1.0
 * @since 2021/06/04
 */
class ActivityTypeDataAdapter(private val list: List<ActivityBean.TypeBean>) :
    RecyclerView.Adapter<ActivityTypeDataAdapter.ViewHolder>() {
    class ViewHolder(val binding: MainItemActivityTypeBinding) :
        RecyclerView.ViewHolder(binding.root) {

    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        return ViewHolder(
            MainItemActivityTypeBinding.inflate(
                LayoutInflater.from(parent.context),
                parent,
                false
            )
        )
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val typeBean = list[position]
        holder.binding.tvName.text = typeBean.name
    }

    override fun getItemCount(): Int = list.size
}